package com.example.testinternet.utils;

import android.util.Log;

import com.squareup.okhttp.Call;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

import java.io.IOException;

/**
 * Created by wly on 2019/4/11.
 */

public class InternetUtils {
    public static   Response responseResult;
    public static void requestUrl(String ip){
        //1-创建okhttpclient
        OkHttpClient client=new OkHttpClient();
        //2-创建一个请求对象
        Request request=new Request.Builder().url(ip).build();
        //3-客户端创建请求
        Call call=client.newCall(request);
        //4-将请求添加到调度队列
        call.enqueue(new Callback() {
            @Override
            public void onFailure(Request request, IOException e) {
            }
            @Override
            public void onResponse(Response response) throws IOException {


            }
        });
    }
}
